<?php if ($view->result === true) : ?>
    <div class="alert alert-success">
        Programación periódica de ruta fue agendada con éxito
    </div>
<?php endif; ?>
<?php if ($view->result === false) : ?>
    <div class="alert alert-danger">
        Programación periódica de ruta no pudo ser agendada.
    </div>
<?php endif; ?>
<form method="post">
    <fieldset>
        <legend>Datos de inicio de programación periódica</legend>
        <div class="form-group row">
            <div class="col-lg-3">
                <label>Fecha (yyyy-mm-dd)</label>
                <input type="date" name="date" id="dateRoot" class="form-control" required="required"/>
            </div>
        </div>
        <div class="form-group">
            <label>Hora</label>
            <br/>
            <div class="pull-left">
                <select class="form-control input-small" name="hours" >
                    <option>00</option>
                    <option>01</option>
                    <option>02</option>
                    <option>03</option>
                    <option>04</option>
                    <option>05</option>
                    <option>06</option>
                    <option>07</option>
                    <option>08</option>
                    <option>09</option>
                    <option>10</option>
                    <option>11</option>
                    <option>12</option>
                    <option>13</option>
                    <option>14</option>
                    <option>15</option>
                    <option>16</option>
                    <option>17</option>
                    <option>18</option>
                    <option>19</option>
                    <option>20</option>
                    <option>21</option>
                    <option>22</option>
                    <option>23</option>
                </select>
            </div>
            <div class="pull-left">
                &nbsp;:&nbsp;
            </div>
            <div class="pull-left">
                <select class="form-control input-mini" name="mins" >
                    <option>00</option>
                    <option>05</option>
                    <option>10</option>
                    <option>15</option>
                    <option>20</option>
                    <option>25</option>
                    <option>30</option>
                    <option>35</option>
                    <option>40</option>
                    <option>45</option>
                    <option>50</option>
                    <option>55</option>
                </select>
            </div>
        </div>
    </fieldset>
    <br/>
    <fieldset>
        <legend>Periodicidad</legend>
        <label class="checkbox-inline">
            <input type="checkbox" name="week" id="week"> Semanalmente
        </label>
        <br/>
        <label class="checkbox-inline dia">
            <input type="checkbox" name="lu"> Lunes
        </label>
        <label class="checkbox-inline dia">
            <input type="checkbox" name="ma"> Martes
        </label>
        <label class="checkbox-inline dia">
            <input type="checkbox" name="mi"> Miércoles
        </label>
        <label class="checkbox-inline dia">
            <input type="checkbox" name="ju"> Jueves
        </label>
        <label class="checkbox-inline dia">
            <input type="checkbox" name="vi"> Viernes
        </label>
        <label class="checkbox-inline dia">
            <input type="checkbox" name="sa"> Sábado
        </label>
        <label class="checkbox-inline dia">
            <input type="checkbox" name="do"> Domingo
        </label>
    </fieldset>
    <br/>
    <button type="submit" class="btn btn-primary">Agendar ruta periódicamente</button>
</form>
<script type="text/javascript">
    $(document).ready(function() {
        $('#week').click(function() {
            var checked = $(this).attr('checked');
            if (checked === undefined)
            {
                $('.dia input').removeAttr('disabled');
            }
            else
            {
                $('.dia input').attr('disabled', 'disabled');
                $('.dia input').removeAttr('checked');
            }
        });
        $('.dia input').click(function() {
            var checked = $(this).attr('checked');
            if (checked === undefined)
            {
                $('#week').removeAttr('disabled');
            }
            else
            {
                $('#week').attr('disabled', 'disabled');
                $('#week').removeAttr('checked');
            }
        });
    });
</script>